﻿namespace LeRenard
{
    /// <summary>
    /// Defines a continuous "counter" of type <typeparamref name="T"/> that cycles through a range.
    /// </summary>
    /// <typeparam name="T"><see cref="Type"/> of the counter.</typeparam>
    public interface IRangeCycler<T>
    {
        /// <summary>
        /// Gets the <see cref="IRange"/> of <typeparamref name="T"/> this counter operates in.
        /// </summary>
        IRange<T> Range { get; }

        /// <summary>
        /// Gets the current value in the counter.
        /// </summary>
        T Current { get; }

        /// <summary>
        /// Gets the next value in the counter, and increments the internal counter.
        /// </summary>
        /// <returns>The next <typeparamref name="T"/> value.</returns>
        T Next();

        /// <summary>
        /// Peeks what the next value in the counter will be.
        /// </summary>
        /// <returns>The next <typeparamref name="T"/> value.</returns>
        T Peek();

        /// <summary>
        /// Resets the <see cref="ICounter"/>.
        /// </summary>
        void Reset();

        /// <summary>
        /// Resets the <see cref="ICounter"/> with the given <paramref name="initialValue"/>.
        /// </summary>
        /// <param name="initialValue">The value to resert the <see cref="ICounter"/> to.</param>
        void Reset(T initialValue);
    }
}
